<template>
  <yt-page title="重大危险源详情" scroll>
    <yt-card title="基本信息">
      <yt-cell label="填报单位名称" labelWidth="120px" :value="item.unit"></yt-cell>
      <yt-cell label="危险源名称" :value="item.name"></yt-cell>
      <yt-cell label="事故类型" :value="item.genre"></yt-cell>
      <yt-cell label="所在位置" :value="item.address"></yt-cell>
      <yt-cell label="危险源等级" :value="item.level"></yt-cell>
    </yt-card>
    <yt-card title="相关人员信息">
      <yt-cell label="危险源负责人" labelWidth="100px" :value="item.responsible"></yt-cell>
      <yt-cell label="负责人所在部门" labelWidth="120px" :value="item.responsibleDepart"></yt-cell>
      <yt-cell label="负责人电话">
        <yt-cell-call :tel="item.responsibleMobile || ''"></yt-cell-call>
      </yt-cell>
      <yt-cell label="填报人" labelWidth="100px" :value="item.write"></yt-cell>
      <yt-cell label="填报人所在部门" labelWidth="150px" :value="item.writeDepart"></yt-cell>
      <yt-cell label="填报人联系电话" labelWidth="150px">
        <yt-cell-call :tel="item.writeMobile || ''"></yt-cell-call>
      </yt-cell>
      <yt-cell label="评估日期" :value="item.assess"></yt-cell>
    </yt-card>
  </yt-page>
</template>

<script>
  import {commonApi} from "@/common/api/commonApi.js"
  import { ReplaceDictionary } from "@/common/utils/index.js"

  export default {
    data() {
      return {
        item: {}
      }
    },
    activated() {
      this.initData()
    },
    methods: {
      async initData() {
        let p = [
          commonApi.searchById('security_risk_filing', this.$route.query.id),
          commonApi.dictionary('evaluation_level'),
          commonApi.dictionary('disaster'),
          commonApi.search('ent_enterprise')
        ]
        let [ item, levelDic, disasterDic, entList ] = await Promise.all(p)
        this.item = ReplaceDictionary(item, { level: levelDic, 'unit:EnterpriseName:id': entList, genre: disasterDic })
      }
    }
  }
</script>

<style lang="stylus" scoped rel="stylesheet/stylus" type="text/stylus">
  >>> .yt-collapse-content
    .yt-cell
      background-color transparent
    .yt-cell-label
      padding 0

  .no-data
    text-align center
    font-size 15px
    color #aaa

  .table
    width 100%
    font-size 13px
    tr
      border-bottom .5px solid #f5f5f5
    tbody tr:last-child
      border-bottom none
    th
      font-weight 600
      line-height 30px
    td
      text-align center
      line-height 30px
</style>
